import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';
export namespace PerFamilySupervisorApi {
  /** 境内主管信息 */
  export interface FamilySupervisor {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应 system_person.id
    familyName: string; // 姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 证件号码
    cohabit: string; // 是否共同生活（是/否）
    companyName: string; // 企业名称
    countryRegion: string; // 国家
    branchAddress: string; // 分支机构地址
    position: string; // 所任职务
    status: number; // 记录状态（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询境内主管分页 */
export function getFamilySupervisorPage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<
    PageResult<PerFamilySupervisorApi.FamilySupervisor>
  >('/per/family-supervisor/page', data, { desensitize, encrypt });
}

/** 查询境内主管详情 */
export function getFamilySupervisor(id: number) {
  return requestClient.get<PerFamilySupervisorApi.FamilySupervisor>(
    `/per/family-supervisor/get?id=${id}`,
  );
}

/** 新增境内主管 */
export function createFamilySupervisor(
  data: PerFamilySupervisorApi.FamilySupervisor,
) {
  return requestClient.post('/per/family-supervisor/create', data);
}

/** 修改境内主管 */
export function updateFamilySupervisor(
  data: PerFamilySupervisorApi.FamilySupervisor,
) {
  return requestClient.put('/per/family-supervisor/update', data);
}

/** 删除境内主管 */
export function deleteFamilySupervisor(id: number) {
  return requestClient.delete(`/per/family-supervisor/delete?id=${id}`);
}

/** 批量删除境内主管 */
export function deleteFamilySupervisorList(ids: number[]) {
  return requestClient.delete(
    `/per/family-supervisor/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出境内主管 */
export function exportFamilySupervisor(params: any) {
  return requestClient.download('/per/family-supervisor/export-excel', {
    params,
  });
}
